<script setup lang="ts">
import { useRouter } from '@tarojs/taro';

import Page from '@/components/common/Page.vue';
import ContentTip from '@/pages/index/components/ContentTip.vue';

import ApiOrder from '@/api/order';
import useFetch from '@/hooks/useFetch';

import { TPaymentOrder } from '@/global';
const { params } = useRouter();

// 订单支付详情
const { data: orderDetail } = useFetch<TPaymentOrder>(ApiOrder.getChargeOrderDetail, {
  defaultParams: { sn: params.sn },
  afterFetch: (data: any) => data.order
});

</script>

<template>
  <Page height="260rpx">

    <view class="pt-6">
      <ContentTip>
        <view class="text-[40px] font-bold text-dark text-center">
          <!-- <view>恭喜您</view> -->
          <view>{{ '支付成功' }}</view>
          <!-- <view>{{ orderDetail?.pay_status === 1 ? '支付成功' : '支付失败'}}</view> -->
          <view class="flex flex-column items-end">
            <view class="text-2xl mt-6 mb-2.5 text-right w-1/3"> ¥ </view>
            <view class="text-[48px] mt-6 mb-1.5 ml-2"> {{ orderDetail?.pay_total / 100 }} </view>
          </view>
        </view>
      </ContentTip>

      <!-- wxml文件 -->
      <view class="mx-[32px]">
        <ad-custom unit-id="adunit-bdee55e683e49104" bindload="adLoad" binderror="adError"
                   bindclose="adClose"></ad-custom>
      </view>
    </view>
  </Page>
</template>